//
//  PhotoViewController.m
//  土巴兔
//
//  Created by 千锋 on 15/12/30.
//  Copyright (c) 2015年 IOS1503薛凯. All rights reserved.
//

#import "PhotoViewController.h"
#import "SecondPhotoViewController.h"
#import "Default.h"
#import "AFNetworking.h"
#import "SecondCollectionViewCell.h"
#import "FirstModel.h"
#import "SecondModel.h"
#import "FirstCollectionViewCell.h"
#import "HMWaterflowLayout.h"
@interface PhotoViewController ()<UICollectionViewDataSource,UICollectionViewDelegate,HMWaterflowLayoutDelegate>
@property (weak, nonatomic) IBOutlet UISegmentedControl *segment;
@property (weak, nonatomic) IBOutlet UIButton *fenggebtn;
@property (weak, nonatomic) IBOutlet UIButton *kongjianbtn;
@property (weak, nonatomic) IBOutlet UIButton *jububtn;
@property (weak, nonatomic) IBOutlet UIButton *yansebtn;
@property (weak, nonatomic) IBOutlet UIView *fenggeView;
@property (weak, nonatomic) IBOutlet UIView *huxingView;
@property (weak, nonatomic) IBOutlet UIView *mianjiView;
@property (weak, nonatomic) IBOutlet UIView *yanseView;

@property (strong,nonatomic)UICollectionView* collection;
@property (strong,nonatomic)HMWaterflowLayout* layout;
@property (strong,nonatomic)NSMutableArray* dataArray;

@property (strong,nonatomic)AFHTTPRequestOperationManager* manager;
//纪录当前局部，颜色，空间，风格，那个面板被打开
@property (strong,nonatomic)UIView* FlagView;

@property (strong,nonatomic)NSMutableArray* heightArray;

//网页请求头
@property (strong,nonatomic)NSString* urlStr;
@property (strong,nonatomic)NSMutableDictionary* paras;
@end

@implementation PhotoViewController

#pragma mark- 页面生命周期
- (void)viewDidLoad {
   
    [super viewDidLoad];
    _segment.layer.cornerRadius=16;
    _segment.clipsToBounds=YES;
    _segment.selectedSegmentIndex=0;
    
    [self relayoutNav];
    _yanseView.hidden=YES;
    _mianjiView.hidden=YES;
    _huxingView.hidden=YES;
    _fenggeView.hidden=YES;
//    _heightArray=[[NSMutableArray alloc] initWithCapacity:0];

    _manager=[AFHTTPRequestOperationManager manager];
    _manager.responseSerializer=[AFHTTPResponseSerializer serializer];
    [self initRequest];
    [self getData];
    [self createCollection];
}
- (void)viewWillAppear:(BOOL)animated{
    if (_segment.selectedSegmentIndex==1) {
        _segment.selectedSegmentIndex-=1;
    }
}
#pragma mark- 初始化请求头
- (void)initRequest{
    _urlStr=@"http://mobileapi.to8to.com/index.php";
    NSMutableDictionary* para=[NSMutableDictionary dictionaryWithDictionary:@{@"action":@"setsList",@"initialize":@"0",@"perPage":@"30",@"style":@"",@"appid":@"15",@"to8to_token":@"5577450_75ff93ea5d8fae3c8a5a0ef1cb6dc1db",@"homeType":@"",@"systemversion":@"22",@"imei":@"569eb1056c38e1e8",@"area":@"",@"appversion":@"3.6.0",@"appostype":@"1",@"color":@"",@"version":@"2.5",@"uid":@"5577450",@"page":@"1",@"channel":@"%E9%AD%85%E6%97%8F%E5%BA%94%E7%94%A8%E4%B8%AD%E5%BF%83",@"paging":@"true",@"model":@"images"}];
    [para setObject:[[NSUserDefaults standardUserDefaults] objectForKey:@"to8to_token"] forKey:@"to8to_token"];
    [para setObject:[[NSUserDefaults standardUserDefaults] objectForKey:@"uid"] forKey:@"uid"];
    _paras=[[NSMutableDictionary alloc] initWithDictionary:para];
    
}
#pragma mark- 重新设置导航布局
- (void)relayoutNav{
    self.navigationController.navigationBarHidden=YES;
}

- (IBAction)segmentChange:(UISegmentedControl *)sender {
    switch ([sender selectedSegmentIndex]) {
        case 1:
            [self.navigationController pushViewController:[[SecondPhotoViewController alloc] init] animated:NO];
            break;
            
        default:
            break;
    }
}

- (IBAction)Pressfengge:(UIButton *)sender {
    if (_FlagView!=_fenggeView) {
        _FlagView.hidden=YES;
        _FlagView=_fenggeView;
    }
    _fenggeView.hidden=!_fenggeView.hidden;
}
- (IBAction)Presshuxing:(UIButton *)sender {
    if (_FlagView!=_huxingView) {
        _FlagView.hidden=YES;
        _FlagView=_huxingView;
    }
    _huxingView.hidden=!_huxingView.hidden;
}
- (IBAction)Pressmianji:(UIButton *)sender {
    if (_FlagView!=_mianjiView) {
        _FlagView.hidden=YES;
        _FlagView=_mianjiView;
    }
    _mianjiView.hidden=!_mianjiView.hidden;
}
- (IBAction)Pressyanse:(UIButton *)sender {
    if (_FlagView!=_yanseView) {
        _FlagView.hidden=YES;
        _FlagView=_yanseView;
    }
    _yanseView.hidden=!_yanseView.hidden;
}
#pragma mark- 获取数据
- (void)getData{
    _dataArray=[[NSMutableArray alloc] initWithCapacity:0];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        if ([arr isKindOfClass:[NSArray class]]) {
            for (NSDictionary* item in arr) {
                FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
                for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                    SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                    [model.info addObject:secondmodel];
                }
                
                [_dataArray addObject:model];
                [_collection reloadData];
                
            }
            
        }else{
            UIAlertView* alertview=[[UIAlertView alloc] initWithTitle:@"Tip" message:@"你的身份信息已经过期" delegate:self cancelButtonTitle:@"YES" otherButtonTitles:nil];
            [alertview show];
        }
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
}
#pragma mark- 创建网格
- (void)createCollection{
    _layout=[[HMWaterflowLayout alloc] init];
    _layout.delegate=self;
    _layout.columnsCount=2;
//    _layout.rowMargin=10;
    _collection=[[UICollectionView alloc] initWithFrame:CGRectMake(0, 65, DEVICEWIDTH, DEVICEHEIGHT) collectionViewLayout:_layout];
    _collection.backgroundColor=[UIColor whiteColor];
    _collection.delegate=self;
    _collection.dataSource=self;
    [_collection registerClass:[FirstCollectionViewCell class] forCellWithReuseIdentifier:@"FirstCollectionViewCell"];
    [self.view insertSubview:_collection atIndex:0];
}
#pragma mark- 自定义布局协议
- (CGFloat)waterflowLayout:(HMWaterflowLayout *)waterflowLayout heightForWidth:(CGFloat)width atIndexPath:(NSIndexPath *)indexPath{
//    CGFloat weidth=(DEVICEWIDTH-30)/2;
    FirstModel* firmodel=_dataArray[indexPath.row];
    SecondModel* secmodel=firmodel.info[0];
    CGFloat height=[secmodel.height floatValue]*width/[secmodel.width floatValue];
    return height;
}
#pragma mark- 网格协议
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return _dataArray.count;
}
- (UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

    FirstCollectionViewCell* cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"FirstCollectionViewCell" forIndexPath:indexPath];
    [cell relayoutUIWithModel:_dataArray[indexPath.row]];
  
    return cell;
}
#pragma mark- 选择按钮事件
#pragma mark- 风格
//不限
- (IBAction)fenggeClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"不限" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}
//宜家
- (IBAction)yijiaClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"宜家" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"18" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}
//现代
- (IBAction)xiandaiClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"现代" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"15" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}
//简欧
- (IBAction)jianouClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"简欧" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"20" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}
//欧式
- (IBAction)oushiClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"欧式" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"2" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}
//北欧
- (IBAction)beiouClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"北欧" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"19" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}
//中式
- (IBAction)zhongshiClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"中式" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"4" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}
//简约
- (IBAction)jianyueClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"简约" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"13" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}
//地中海
- (IBAction)dizhonghaiClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"地中海" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"12" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}
//日式
- (IBAction)rishiClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"日式" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"17" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}
//美式
- (IBAction)meishiClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"美式" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"9" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}
//东南亚
- (IBAction)dongnanyaClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"东南亚" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"8" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}
//田园
- (IBAction)tianyuanClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"田园" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"11" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}
//混搭
- (IBAction)hundaClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"混搭" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"100" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}
//新古典
- (IBAction)xingudianClick:(UIButton *)sender {
    [_fenggebtn setTitle:@"新古典" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"6" forKey:@"style"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _fenggeView.hidden=YES;
}

#pragma mark- 户型
//不限
- (IBAction)buxianClick:(UIButton *)sender {
    [_kongjianbtn setTitle:@"不限" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"0" forKey:@"homeType"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _huxingView.hidden=YES;
}
//一居
- (IBAction)yijuClick:(UIButton *)sender {
    [_kongjianbtn setTitle:@"一居" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"7" forKey:@"homeType"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _huxingView.hidden=YES;
}
//二居
- (IBAction)erjuClick:(UIButton *)sender {
    [_kongjianbtn setTitle:@"二居" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"2" forKey:@"homeType"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _huxingView.hidden=YES;
}
- (IBAction)sijuClick:(UIButton *)sender {
    [_kongjianbtn setTitle:@"四居" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"4" forKey:@"homeType"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _huxingView.hidden=YES;
}
- (IBAction)gongyuClick:(UIButton *)sender {
    [_kongjianbtn setTitle:@"公寓" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"8" forKey:@"homeType"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _huxingView.hidden=YES;
}
- (IBAction)fushiClick:(UIButton *)sender {
    [_kongjianbtn setTitle:@"复式" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"5" forKey:@"homeType"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _huxingView.hidden=YES;
}
- (IBAction)bieshuClick:(UIButton *)sender {
    [_kongjianbtn setTitle:@"别墅" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"6" forKey:@"homeType"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _huxingView.hidden=YES;
}
- (IBAction)xiaohuxingClick:(UIButton *)sender {
    [_kongjianbtn setTitle:@"小户型" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"1" forKey:@"homeType"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _huxingView.hidden=YES;
}
- (IBAction)sanjuClick:(UIButton *)sender {
    [_kongjianbtn setTitle:@"三居" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"3" forKey:@"homeType"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _huxingView.hidden=YES;
}
#pragma mark- 面积MJ
//不限
- (IBAction)MJbuxianClick:(UIButton *)sender {
    [_jububtn setTitle:@"不限" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"0" forKey:@"area"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _mianjiView.hidden=YES;
}
//60以下
- (IBAction)MJ60yixiaClick:(UIButton *)sender {
    [_jububtn setTitle:@"60以下" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"1" forKey:@"area"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _mianjiView.hidden=YES;
}
//60-80
- (IBAction)MJ60To80Click:(UIButton *)sender {
    [_jububtn setTitle:@"60-80" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"2" forKey:@"area"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _mianjiView.hidden=YES;
}
//80-100
- (IBAction)MJ80To100Click:(UIButton *)sender {
    [_jububtn setTitle:@"80-100" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"3" forKey:@"area"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _mianjiView.hidden=YES;
}
//120-150
- (IBAction)MJ120To150Click:(UIButton *)sender {
    [_jububtn setTitle:@"120-150" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"5" forKey:@"area"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _mianjiView.hidden=YES;
}
//150以上
- (IBAction)MJ120ToClick:(UIButton *)sender {
    [_jububtn setTitle:@"150以上" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"6" forKey:@"area"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _mianjiView.hidden=YES;
}
//100－120
- (IBAction)MJ100To120Click:(UIButton *)sender {
    [_jububtn setTitle:@"100-120" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"4" forKey:@"area"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _mianjiView.hidden=YES;
}
#pragma mark- 颜色YS
//不限
- (IBAction)YSbuxianClick:(UIButton *)sender {
    [_yansebtn setTitle:@"不限" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"0" forKey:@"color"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _yanseView.hidden=YES;
}
//白色
- (IBAction)YSbaiseClick:(UIButton *)sender {
    [_yansebtn setTitle:@"白色" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"1" forKey:@"color"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _yanseView.hidden=YES;
}
//米色
- (IBAction)YSfenhong:(UIButton *)sender {
    [_yansebtn setTitle:@"米色" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"12" forKey:@"color"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _yanseView.hidden=YES;
}
//黄色
- (IBAction)YSyellowClick:(UIButton *)sender {
    [_yansebtn setTitle:@"黄色" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"4" forKey:@"color"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _yanseView.hidden=YES;
}
//橙色
- (IBAction)YSOrangeClick:(UIButton *)sender {
    [_yansebtn setTitle:@"橙色" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"6" forKey:@"color"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _yanseView.hidden=YES;
}
//红色
- (IBAction)YSRedClick:(UIButton *)sender {
    [_yansebtn setTitle:@"红色" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"3" forKey:@"color"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _yanseView.hidden=YES;
}
//粉色
- (IBAction)YSLightRedClick:(UIButton *)sender {
    [_yansebtn setTitle:@"粉色" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"7" forKey:@"color"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _yanseView.hidden=YES;
}
//绿色
- (IBAction)YSYellowGreenClick:(UIButton *)sender {
    [_yansebtn setTitle:@"绿色" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"5" forKey:@"color"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _yanseView.hidden=YES;
}
//蓝色
- (IBAction)YSBlueClick:(UIButton *)sender {
    [_yansebtn setTitle:@"蓝色" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"8" forKey:@"color"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _yanseView.hidden=YES;
}
//紫色
- (IBAction)YSPurpleClick:(UIButton *)sender {
    [_yansebtn setTitle:@"紫色" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"10" forKey:@"color"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _yanseView.hidden=YES;
}
//黑色
- (IBAction)YSBlackClick:(UIButton *)sender {
    [_yansebtn setTitle:@"黑色" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"2" forKey:@"color"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _yanseView.hidden=YES;
}
//咖啡色
- (IBAction)YSBrownClick:(UIButton *)sender {
    [_yansebtn setTitle:@"咖啡色" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"14" forKey:@"color"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _yanseView.hidden=YES;
}
//灰色
- (IBAction)YSGrawClick:(UIButton *)sender {
    [_yansebtn setTitle:@"灰色" forState:UIControlStateNormal];
    [_dataArray removeAllObjects];
    [_paras setObject:@"9" forKey:@"color"];
    [_manager POST:_urlStr parameters:_paras success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary* dic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSArray* arr=[dic objectForKey:@"data"];
        for (NSDictionary* item in arr) {
            FirstModel* model=[[FirstModel alloc] initWithDictionary:item];
            for (NSDictionary* item2 in [item objectForKey:@"info"]) {
                SecondModel* secondmodel=[[SecondModel alloc] initWithDictionary:item2];
                [model.info addObject:secondmodel];
            }
            [_dataArray addObject:model];
            [_collection reloadData];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    _yanseView.hidden=YES;
}

@end
